Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
input(type="checkbox", id="toggle-btn") label.toggle-btn(for="toggle-btn") click! .dark-mode-mask .card Moon waltzing through the midnight sky. .arrow-btn .card Ocean's whispers, waves in rhythmic dance. .arrow-btn .card City lights twinkling like a galaxy born of human dreams. .arrow-btn
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; } @import url('https://fonts.googleapis.com/css2?family=Aboreto&display=swap'); @mixin flexCenter { display: flex; justify-content: center; align-items: center; } * { box-sizing: border-box; } html { font-size: 100vmax / 1600 * 100; @media (max-width: 992px) { font-size: 60px; } } body { min-height: 100vh; padding: 0.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: #222; background-color: #eee; // ✨ MUST ADD BG COLOR font-size: 0.24rem; font-family: 'Aboreto', sans-serif; } .card { width: 5rem; height: 1.8rem; padding: 0.3rem 0.5rem; display: flex; align-items: center; justify-content: space-between; gap: 0.2rem; line-height: 1.5; border: 1px solid; border-radius: 0.3rem; box-shadow: 3px 3px 0 3px #222; cursor: crosshair; overflow: hidden; } .arrow-btn { flex-shrink: 0; width: 0.7rem; height: 0.7rem; @include flexCenter; color: #eee; background-color: #222; border-radius: 50%; cursor: pointer; &:before { content: '\2192'; } } input[type='checkbox'] { display: none; &:checked { ~ .dark-mode-mask { transform: scale(50); } ~ .toggle-btn { background-color: #fff; } } } // for dark mode .dark-mode-mask, .toggle-btn { position: fixed; bottom: 0.3rem; right: 0.3rem; width: 1rem; height: 1rem; border-radius: 50%; } .toggle-btn { @include flexCenter; font-size: 0.8em; color: orange; background-color: #222; cursor: pointer; z-index: 1; transition: all 0.3s; will-change: background-color; // pulse effect &:before { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; height: 100%; background-color: inhrit; border-radius: inherit; animation: pulse 1.2s infinite linear; pointer-events: none; } } .dark-mode-mask { pointer-events: none; // ✨ trick here background-color: #fff; mix-blend-mode: difference; transition: all 0.5s ease; will-change: transform; } @keyframes pulse { 0% { box-shadow: 0 0 0 0 #222a; } 40% { box-shadow: 0 0 0 0.1rem #2222; opacity: 0.7; } 80% { box-shadow: 0 0 0 0.15rem #2222; opacity: 0; } 100% { opacity: 0; } }
console.log("Event Fired")